//
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership.  The ASF licenses this file
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at
 
      http://www.apache.org/licenses/LICENSE-2.0
 
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

nav.navbar.navbar-default.navbar-fixed-top.navbar-main
  #fold-button.btn.btn-default.navbar-btn.pull-left(ng-click='showSidebar()')
    i.fa.fa-navicon

  .navbar-title
    | Submit new Job

#content-inner(ng-if="noaccess")
  pre
    | {{noaccess}}
#content-inner(ng-if="!noaccess && yarn")
  pre(ng-if="!address")
    | Yarn's AM proxy doesn't allow file uploads. Please wait while we fetch an alternate url for you to use
  pre(ng-if="address")
    | Yarn's AM proxy doesn't allow file uploads. You can visit&nbsp;
    a(href="{{address}}/#/submit")
      | here
    | &nbsp;to access this functionality.

#content-inner(ng-if="!noaccess && jars && !yarn")
  div(ng-if="error")
    h3 We're sorry, something went wrong. The server responded with:
    pre
      | {{error}}
  .panel.panel-default
    .panel-heading
      h3.panel-title
        | Uploaded Jars

    .panel-body
      table.table
        thead
          tr
            th
            th Name
            th Upload Time
            th Entry Class
            th

        tbody
          tr(ng-repeat="jar in jars track by jar.id")
            td
              span.icon-wrapper
                i.show-pointer.fa(ng-click="selectJar(jar.id)" ng-class="state.selected | getJarSelectClass:jar.id")
            td {{jar.name}}
            td {{jar.uploaded | amDateFormat:'YYYY-MM-DD, H:mm:ss'}}
            td
              div(ng-repeat="entries in jar.entry")
                span.btn.btn-default.row-button(title="{{entries.description}}" ng-click="loadEntryClass(entries.name)")
                  | {{entries.name}}
            td
              span.icon-wrapper
                i.show-pointer.fa.fa-remove(title="Delete" ng-click="deleteJar($event, jar.id)")

  table.table.table-no-border#job-submit-table(ng-if="state.selected")
    tbody
      tr
        td.td-large
          input.form-control(type="text" placeholder="Entry Class" title="Entry Class" ng-model="state['entry-class']")
        td
          input.form-control(type="text" placeholder="Parallelism" title="Parallelism" ng-model="state.parallelism")
        td
          span.btn.btn-default#fetch-plan(ng-click="getPlan()")
            | {{state['plan-button']}}
          | &nbsp;
          i.fa.fa-spin.fa-spinner(ng-if="state['plan-button'] == 'Getting Plan'")
      tr
        td.td-large(colspan="2")
          input.form-control(type="text" placeholder="Program Arguments" title="Program Arguments" ng-model="state['program-args']")
        td
          span.btn.btn-success.btn-sm#job-submit(ng-click="runJob()")
            | {{state['submit-button']}}
          | &nbsp;
          i.fa.fa-spin.fa-spinner(ng-if="state['submit-button'] == 'Submitting'")
      tr
        td
          input.form-control(type="text" placeholder="Savepoint Path" title="Savepoint Path" ng-model="state['savepointPath']")
        td
          label.checkbox-inline
            input.checkbox-inline(type="checkbox", ng-model="state['allowNonRestoredState']")
            | Allow Non Restored State
            

  table.table.table-no-border(ng-if="jid")
    tbody
      tr
        td.text-center
          | Job was successfully submitted. To monitor,&nbsp;
          a(href="{{'#/jobs/' + jid}}")
            | click here.

  .canvas-wrapper(ng-if="plan")
    div.main-canvas(job-plan, plan="plan", jobid="{{plan.jid}}", set-node="changeNode(nodeid)")

  table.table.table-no-border#add-file-table(ng-if="!state.selected")
    tbody
      tr
        td#add-file-button
          span.btn.btn-default.btn-file(ng-click="clearFiles()")
            | Add New&nbsp;
            i.fa.fa-plus
            input(type="file" onchange="angular.element(this).scope().uploadFiles(this.files)")
        td#add-file-name(ng-if="uploader.file" title="{{uploader.file.name}}")
          | {{uploader.file.name}}
        td#add-file-status(ng-if="uploader.file")
          span.error-area(ng-if="uploader.error")
            i
              | {{uploader.error}}
          span.btn.btn-success(ng-click="startUpload()" ng-if="uploader.upload")
            | &nbsp;Upload&nbsp;
          span(ng-if="uploader.success")
            | {{uploader.success}}
          span.btn.btn-progress-bar(ng-if="uploader.progress")
            span.btn.btn-success.btn-progress(ng-style="{width: uploader.progress + '%'}")
              | {{uploader.progress}}%
